package com.nashuju.web.controller.sys;

import org.durcframework.core.controller.CrudController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nashuju.web.entity.sys.SysRes;
import com.nashuju.web.entity.sys.SysResSch;
import com.nashuju.web.service.sys.SysResService;

@Controller
public class SysResController extends CrudController<SysRes, SysResService> {

    @RequestMapping("/addRSysRes.do")
    public @ResponseBody Object addRSysRes(SysRes entity) {
        return this.save(entity);
    }

    @RequestMapping("/listRSysRes.do")
    public @ResponseBody Object listRSysRes(SysResSch searchEntity) {
        return this.queryAll(searchEntity);
    }

    @RequestMapping("/updateRSysRes.do")
    public @ResponseBody Object updateRSysRes(SysRes enity) {
        return this.update(enity);
    }

    @RequestMapping("/delRSysRes.do")
    public @ResponseBody Object delRSysRes(SysRes enity) {
        if (this.getService().hasChild(enity)) {
            return error(enity.getResName() + "下含有子节点,不能删除.");
        }
        return this.delete(enity);
    }

}
